let integer = 21;
let q = 0;
let rem = '';
let s = '';
let length = 0;
q = Math.floor(integer / 2);
while (q != 0) {
    rem = integer % 2;
    s = rem + s;
    q = Math.floor(integer / 2);
    integer = q;
}
length = s.length;
for (let i = 1; i <= 32 - length; i++) {
    s = '0' + s;
    if (((length + i) % 8 == 0) && (length + i) != 32) {
        s = '_' + s;
    }
}
console.log(s);